﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LeHouse.Server.Dto;
namespace LeHouse.Server.Dal
{
    /// <summary>
    /// 建筑公共部位状况的DAL操作层
    /// </summary>
    public class Collateral_FacilityDAL : GenericBaseDAL<Collateral_Facility>
    {
        /// <summary>
        /// 根据报告号去查询建筑公共部位是否有该条记录
        /// </summary>
        /// <param name="P_ReportNumber"></param>
        /// <returns></returns>
        public int IsCount(string T_ReportNumber)
        {
            int C_projectcount;
            string sql = @"select count(T_FacilityID) from Collateral_Facility  where T_ReportNumber=@T_ReportNumber ";
            using (var cnn = DbConnection)
            {
                using (var cmd = cnn.CreateCommand())
                {
                    cmd.CommandText = sql;
                    var p = cmd.CreateParameter();
                    p.ParameterName = "@T_ReportNumber";
                    p.Value = T_ReportNumber;
                    cmd.Parameters.Add(p);
                    C_projectcount = Convert.ToInt32(cmd.ExecuteScalar());
                }
                return C_projectcount;
            }
        }

    }
}
